﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Core.Interfaces;
using Core.Interfaces.IPresenters;
using Core.Presenters;

namespace Core.Views
{
    public partial class ActionView : Form, IActionView
    {
        public ActionView()
        {
            InitializeComponent();
        }

        private void label2_Click(object sender, EventArgs e)
        {

        }

        public BindingSource Buildings
        {
            get { return iBuildingBindingSource; }
            set { iBuildingBindingSource = value; }
        }

        public BindingSource Action
        {
            get { return iActionBindingSource; }
            set { iActionBindingSource = value; }
        }

        public BindingSource BuildingsOnAction
        {
            get { return buildingsOnAction; }
            set { buildingsOnAction = value; }
        }

        public event EventHandler SaveAction;
        public event EventHandler AddToLeft;
        public event EventHandler AddToRight;
        public event EventHandler AddAllToLeft;
        public event EventHandler AddAllToRight;

        private void SaveButton_Click(object sender, EventArgs e)
        {
            if (SaveAction != null)
                SaveAction(this, null);
        }

        private void ToRight_Click(object sender, EventArgs e)
        {
            if (AddToRight != null)
            {
                AddToRight(this, null);
            }
        }

        private void ToLeft_Click(object sender, EventArgs e)
        {
            if (AddToLeft != null)
            {
                AddToLeft(this, null);
            }
        }

        private void AllToLeft_Click(object sender, EventArgs e)
        {
            if (AddAllToLeft != null)
            {
                AddAllToLeft(this, null);
            }
        }

        private void AllToRight_Click(object sender, EventArgs e)
        {
            if (AddAllToRight != null)
            {
                AddAllToRight(this, null);
            }
        }

        private void CancelButton_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            
        }

        private void button2_Click(object sender, EventArgs e)
        {
            var bp = new BuyingPresenter((IBuilding) buildingsOnAction.Current,(IAction) iActionBindingSource.Current, new BuyingView());
        }
    }
}
